﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE GetProductRecordFromCategoryBrand
	@categoryId int,
	@brandId int,
	@rowNumber int
	
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	WITH ProductsTable AS 
	( 
		SELECT ROW_NUMBER() OVER (ORDER BY ProductId ASC)
		AS Row, ProductId, Title, Description, BrandId, Specification, Features, CategoryId, Roles, DealerPrice, DealerWholesalePrice, Price, DefaultImageId, 
                      WarrantyId, ShippingWeight, ShippingCost, ATTradeArticle
		FROM Products
		Where CategoryId = @categoryId and BrandId = @brandId
	)

	SELECT Title, ProductId,  Description, BrandId, Specification, Features, CategoryId, Roles, DealerPrice, DealerWholesalePrice, Price, DefaultImageId, 
                      WarrantyId, ShippingWeight, ShippingCost, ATTradeArticle
	FROM ProductsTable 
	WHERE Row = @rowNumber
END


